<extend name="Public/base" />

<block name="body">
    <div class="main-title" style="padding-bottom: 10px;">
        <h2>商品分类列表 [
        
        <a href="{:U('SpPcategory/index','type=1')}">销售分类</a> | 
        <a href="{:U('SpPcategory/index','type=2')}">进货分类</a> 
        ]
        </h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn btn-default" href="{:U('add')}&pid={$pid}">添  加</a>
            
            <if condition="$pid gt 0">
                <a class="btn btn-default" href="{:U('index')}">返  回</a>
            </if>
        </div>
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
        
        </div>
    </div>
 <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table>
            <thead>
                <tr>
                    <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                    <th>编号</th>
                    <th>分类名称</th>
                    <th>属于</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr>
                            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
                            <td>{$vo.id} </td>
                            <td>
                                {$vo.name}<eq name="vo.isDisposal" value="1">【处理品】</eq>
                            </td>
                             <td>
                                 
                                 <eq name="vo.type" value="1">
                                  销售分类
                                 <else/>
                                 进货分类
                                  </eq>
                       
                         </td>
                         <td>{$vo.status_text}</td>
                            <td>
                                <a href="{:U('SpPcategory/edit')}&id={$vo['id']}" class="btn btn-primary">编辑</a>
                                <a href="{:U('SpPcategory/changeStatus?id='.$vo['id'])}&method=delete" class="confirm ajax-get btn btn-warning">删除</a>
                                
                                <eq name="vo.status" value="1">
                                <a href="{:U('SpPcategory/changeStatus?id='.$vo['id'])}&method=forbid" class="confirm ajax-get btn btn-warning ">禁用</a>
                                <else/>
                                 <a href="{:U('SpPcategory/changeStatus?id='.$vo['id'])}&method=resume" class="confirm ajax-get btn btn-warning">启用</a>
                                </eq>

                               
                                
                            </td>
                        </tr>
                    </volist>
                <else/>
                    <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
        
        //导航高亮
        highlight_subnav('{:U('SpPcategory/index')}');
    </script>
</block>